package com.piao.springbootunifiedresult.controller;

import com.piao.springbootunifiedresult.Entity.Student;
import com.piao.springbootunifiedresult.common.Result.R;
import com.piao.springbootunifiedresult.mapper.StudentMapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class TestController {

    @Resource
    StudentMapper wordMapper;

    @ApiOperation(value = "所有学生的列表")
    @GetMapping("/students")
    public R wordList(){
        List<Student> list = wordMapper.selectList(null);
        //链式调用
        return R.ok().data("studentList", list).message("学生列表");
        //R.ok() 无数据
    }
}
